/*
 * @Author: szx
 * @Date: 2022-02-24 12:39:06
 * @LastEditTime: 2022-02-24 12:42:36
 * @Description:
 * @FilePath: \leetcode\1300-1399\1394\1394.js
 */
/**
 * @param {number[]} arr
 * @return {number}
 */
var findLucky = function (arr) {
    const map = new Map();
    for (let a of arr) {
        map.set((map.get(a) || 0) + 1);
    }
    for (let m of map) {
        if (m[0] == m[1]) return m[0];
    }
    return -1;
};
